package com.fary.api;

import com.fary.bo.NotifyMerchantBO;
import com.fary.impl.PayMessageTemplateImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 该类是为测试类并非正式代码
 */
@RestController
public class WeChatTemplateApi {

    @Autowired
    private PayMessageTemplateImpl payMessageTemplateImpl;

    @GetMapping("/testSend")
    public String testSend() {
        payMessageTemplateImpl.notifyMerchantPaymentResultThread(
                NotifyMerchantBO.builder()
                        .merchantId("123456")
                        .merchantOpenId("oScfO6QysJzmuyuA5rggB6omiv-4")
                        .paymentAmount(new BigDecimal(300))
                        .payDate(new Date())
                        .paymentChannel("支付宝")
                        .paymentId("15212521120")
                        .build()
        );
        return "测试发送成功";
    }

    @GetMapping("/testSend1")
    public String testSend1() {
        payMessageTemplateImpl.notifyMerchantPaymentResultMQ(
                NotifyMerchantBO.builder()
                        .merchantId("123456")
                        .merchantOpenId("oScfO6QysJzmuyuA5rggB6omiv-4")
                        .paymentAmount(new BigDecimal(300))
                        .payDate(new Date())
                        .paymentChannel("支付宝")
                        .paymentId("15212521120")
                        .build()
        );
        return "测试发送成功";
    }
}
